/********************************************************************************
 * Project Name		[JavaSE_Fundamentals]
 * File Name     	[Producer.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package thread.producerConsumer;

/**
 * 生产者
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class Producer extends Thread {

	// 每次生产的产品数量
	private int number;

	private Warehouse warehouse;

	public Producer(Warehouse warehouse, int number) {
		this.warehouse = warehouse;
		this.number = number;
	}

	@Override
	public void run() {
		try {
			warehouse.produce(number);
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
